clear
set more off

local titlescore "Occupational"

*Ever Married by Quartile

foreach var in score{

***** 30 yr*****

use $tempdir/panel_trends_30yr_income.dta, clear
keep if race==1

collapse (mean) married ever_married logocc`var'_father, by(qtl_`var'_wgt_full sex year2)
drop if qtl_`var'_wgt_full==.

gen birth_cohort = year2 - 37.5 
gen quartile = qtl_`var'_wgt_full

graph twoway scatter ever_married birth_cohort if quartile==1 & sex==2, sort(year2) connect(direct) lcolor(gs0) lwidth(thick) lpattern(solid) mcolor(gs0) msymbol(circle)  || /*
	*/ scatter ever_married birth_cohort if quartile==2 & sex==2, sort(year2) connect(direct) lcolor(gs3) lwidth(thick) lpattern(dash) mcolor(gs3) msymbol(diamond)  || /*
	*/ scatter ever_married birth_cohort if quartile==3 & sex==2, sort(year2) connect(direct)  lcolor(gs6) lwidth(thick) lpattern(shortdash) mcolor(gs6) msymbol(triangle) || /*
	*/ scatter ever_married birth_cohort if quartile==4 & sex==2, sort(year2) connect(direct) lcolor(gs9) lwidth(thick) lpattern(dot) mcolor(gs9) msymbol(square) /*
	*/ legend(label(1 "Quartile 1 (lowest)") label(2 "Q2") label(3 "Q3") label(4 "Q4")) /*
	*/ xtitle("15 year birth cohort") ytitle("Fraction") graphregion(fcolor(white) lcolor(white))

graph export "$outputdir/ever_married_byqtl.pdf", replace
	
}

*Ever Married by Region

***** 30 yr*****

use $tempdir/panel_trends_30yr_income.dta, clear
keep if race==1

collapse (mean) married ever_married, by(region_birth_coarse sex year2)

gen birth_cohort = year2 - 37.5 

graph twoway scatter ever_married birth_cohort if sex==2 & region_birth_coarse == 1, sort(year2) connect(direct) lcolor(navy) lwidth(thick) mcolor(navy) msymbol(square)  || /*
	*/ scatter ever_married birth_cohort if sex==2 & region_birth_coarse == 2, sort(year2) connect(direct) lcolor(dkgreen) lwidth(thick) mcolor(dkgreen) msymbol(diamond) || /*
	*/ scatter ever_married birth_cohort if sex==2 & region_birth_coarse == 3, sort(year2) connect(direct) lcolor(maroon) lwidth(thick) mcolor(maroon) msymbol(triangle) /*
	*/ legend(rows(1) label(1 "Northeast") label(2 "Midwest") label(3 "South")) /*
	*/ xtitle("15 year birth cohort") ytitle("Fraction") graphregion(fcolor(white) lcolor(white))

graph export "$outputdir/ever_married_byreg.pdf", replace


